Documentation for class complex_object

Inherits from 	object 

Properties declared in complex_object 

Class Methods declared in complex_object 
	new 

Methods declared in complex_object 
	any 
		all_method_names 
		can_be_destroyed 
		destroy 
		duplicate 
		inspect 
		method_names 
		name 
		rename(name) 

Class 
#begin_class
complex_object 
The class complex_object is a subclass of the class object. 
Subclasses of complex_object are classes like button, window, slide, image and sound.
Subclasses of complex_object can be subclassed.
Instances of subclasses of complex_object can be have methods.
#end_class

Properties 

Methods 

#begin_method
all_method_names 
Returns a collection of the names of all the methods of the object, including inherited methods.
Ex:
b := {button}:new
b:all_method_names
returns [#size_to_fit #size_to_hold #perform_click... (and more)
#end_method

#begin_method
can_be_destroyed 
Returns true if the object may be destroyed. Otherwise the method returns false. Examples of objects that may not be destroyed are the base slide in a window, the content slide in a scroller and cells in a matrix.
Ex:
w := {window}:new:open
w:can_be_destroyed 
returns true
w:base_slide:can_be_destroyed
returns false
#end_method

#begin_method
destroy 
Removes the object from memory if the object answers true on the can_be_destroyed message.
If the object is successfully destroyed the method returns nil. Otherwise the method returns false.
Note: This is an irrevocable operation. You cannot get the object back.
#end_method

#begin_method
duplicate 
Returns a copy of the object. The properties of the object that are complex objects will also be duplicated if they are intrinsic.
(You define if a property is intrinsic in the properties aspect of the class inspector).
Ex:
The class window has the property base_slide. This property is intrinsic. If you send duplicate to a window you will get a new window with a new base slide.
#end_method

#begin_method
inspect 
Opens the inspector for the object.
#end_method

#begin_method
method_names 
Returns a collection of the names of all the methods of the object.
Ex:
b := {button}:new:rename(#my_button)
b:method_names
returns [] (since the button has no methods of it own).
define method dummy of {button my_button} as return self end define
(defines a method that always returns self)
b:method_names
returns [#dummy] 
#end_method

#begin_method
name 
Returns the name of the object as a symbol. If the object has no name the method returns nil.
Ex:
b1 := {button}:new:rename(#my_button)
b2 := {button}:new
b1:name
returns #my_button
b2:name
returns nil
#end_method

#begin_method
rename(name) 
Sets the name of the object to the symbol name. If there is another object of the same class, a superclass or a subclass with the name an exception is raised.
Ex:
{button}:new:rename(#my_button)
returns {button my_button}
{button}:new:rename(#tmp)
{button tmp}:rename(#my_button)
raises an exception
Exception:
When trying to rename {button tmp}: There is already one instance of the button class (or any of its subclasses) which is named my_button . This means that the instance can't be renamed !
#end_method

Class Methods 

#begin_class_method
new 
Returns a new object of the class.
Ex:
w := {window}:new
w:open
b := {button}:new
w:base_slide:add_graphic(b)
creates a new window and a new button and puts the button on the base-slide of the window.
Note: This can also be written in one line using cascading:
{window}:new:open:base_slide:add_graphic({button}:new)
#end_class_method